home *** CD-ROM | disk | FTP | other *** search
/ Peanuts 2 / Peanuts - Issue 2 (Alcatraz).adf / GIFconvert.DOC < prev    next >
Text File  |  1992-05-31  |  12KB  |  289 lines

  1.  
  2.  
  3.  ------------------------------------------------------------------------
  4.                              GIFconvert v2.12
  5.                          Written by Geert Coelmont
  6.  ------------------------------------------------------------------------
  7.                             Quick Documentation
  8.  ------------------------------------------------------------------------
  9.  
  10.  
  11.  
  12.  0. History
  13.  ----------
  14.  
  15.     Often, Amiga-freaks and PC-freaks don't like eachother, and it's all
  16.     about whose computer is the best. Well, there really is no doubt about
  17.     the answer, but the problem is to make it clear to those DUMBOS.
  18.  
  19.     War was raging high in our school. That's when the SVGA-craze started.
  20.     Suddenly every PC-freak turned into a Video-Profi and compared to the
  21.     Amiga, his SVGA card could display MANY MANY MANY more colors, (all 
  22.     very similar, but still....) and he showed me some cool pictures he 
  23.     got when he bought his SVGA+MultiSync. Not that many other software
  24.     supported his Very-Very-High-Resolution Graphics, but this single 
  25.     slideshow did, and he had about 10 disks stuffed with it !
  26.  
  27.     No problem MAN ! Amiga can do it too !!!!  Without mega-expensive
  28.     monitors and expansioncards. And I started coding...
  29.  
  30.     After some weeks of research and hard work, the result is there, and
  31.     it is called   >> G I F c o n v e r t <<
  32.  
  33.  
  34.  
  35.  1. What is GIFconvert ?
  36.  -----------------------
  37.  
  38.     GIFconvert is a small utility that will display 'GIF' pictures on
  39.     any Amiga, and optionally save them in IFF, so you can use it 
  40.     together with most other Amiga software.
  41.  
  42.  
  43.  
  44.  2. What is GIF ?
  45.  ----------------
  46.  
  47.     'GIF' is a kind of graphics storage format, similar to IFF, but
  48.     typically created for IBM-PC's with their silly VGA/EGA cards.
  49.     They support a palette of 256 colors out of 16777216 (256*256*256).
  50.  
  51.  
  52.  
  53.  3. Why GIFconvert ?
  54.  -------------------
  55.  
  56.     Converting EGA/VGA to HAM will in most cases cause some loss of
  57.     quality, but GIFconvert uses some cool routines that reduce this loss
  58.     as much as possible. GIFconvert will automatically switch to the most
  59.     appropriate resolution and display mode to get the most out of your
  60.     Amiga. The HAM-routine is really smart and will get rid of those ugly
  61.     colortransitions that are typical for HAM. (see chapter 4)
  62.  
  63.     By the way: New resolutions like Productivity and what's-its-name are
  64.     not supported (yet?) because I don't have any documentation about the
  65.     registers, and I can't test them anyway.
  66.  
  67.  
  68.  
  69.  4. The difference between EGA/VGA and HAM
  70.  -----------------------------------------
  71.  
  72.     EGA and VGA are 'standards' in the PC scene. 'Standards', but there
  73.     exist hundreds of different types, dozens of which are incompatible
  74.     to eachother. (that is only to demonstrate (again) the hopelessness
  75.      of the PC-environment)
  76.     Anyway, in VGA, colors use 24 bits of data. (256 steps in Red, 256 
  77.     in Green and 256 in Blue). So alltogether there are 256^3=16 million 
  78.     different colors to be chosen from, but each picture can use only 
  79.     256 of them at a time, they can be freely chosen and are stored 
  80.     together with the image. Each pixel in the image refers to one color
  81.     in this palette of 256 colors, and obviously, 8 bits are needed for
  82.     that.
  83.  
  84.     On the Amiga, colors use only 12 bits of data: 4096 colors. In normal
  85.     display modes, the same technique as in VGA is used: a palette is
  86.     defined and the image refers to the colors in the palette. For
  87.     32-colored pictures, 5 bits per pixel are required.
  88.  
  89.     The HAM-technique takes it a different way. A palette can be defined
  90.     as described before, but a pixel does not necessarily have to refer
  91.     to one of these palette-colors. A pixel can in fact be two things:
  92.     - An absolute color, one of the 16 defined in the palette,
  93.     - A RELATIVE color, derived from the pixel to the left.
  94.     A relative pixel simply takes the RGB-value of the previous pixel
  95.     (the one to the left) and changes ONE of its components: Red, Green
  96.     or Blue. That's where the name 'Hold-and-Modify' comes from. Two
  97.     components are HELD, one is MODIFIED.
  98.  
  99.     This method implies that sudden colorchanges are not possible;
  100.     changing from one color to a different one, will be done in maximum
  101.     3 steps: one step for each component. As a result, you might find 
  102.     some pixels in wrong color between two different colored surfaces.
  103.     A solution for this colortransition is ofcourse the palette. If a 
  104.     color was defined in the palette, it can be adressed immediately,
  105.     without the 3 steps. Only problem is that there are only 16 colors 
  106.     to be defined in the palette, so it's up to the software to do the
  107.     best possible selection.
  108.  
  109.     Now what is the benefit of this complex method of adressing a pixel's
  110.     color ?  Well first of all, it was designed for use with digitized
  111.     images, because they mainly consist of smooth colorchanges. I've 
  112.     heard the technique is used too in the TV-scene somewhere, but I'm
  113.     not sure about that.
  114.     Anyway, the main advantage is that you can address 4096 colors with 
  115.     only 6 bits of data for each pixel (check it out):
  116.  
  117.     bit 0,1,2 and 3 are the main bits, they form a number between 0 and
  118.     15. Bit 4 and 5 are the control bits, they decide what bits 0-3
  119.     stand for:
  120.  
  121.     4 | 5
  122.     --+--
  123.     0 | 0    Bit 0-3 are used as absolute reference to one of the 16
  124.       |            colors in the palette: i.e. 12 refers to color12
  125.     0 | 1    Bit 0-3 are used as NEW value for the RED component, the
  126.       |            Blue and Green components don't change.
  127.     1 | 1    Bit 0-3 are used as NEW value for the GREEN component,
  128.       |            the Blue and Red components don't change.
  129.     1 | 0    Bit 0-3 are used as NEW value for the BLUE component, 
  130.       |            the Red and Green components don't change.
  131.  
  132.     As you now can see, in maximum 3 steps, HAM can address any of the
  133.     4096 colors with only 6 bits of data, where the VGA technique
  134.     already uses 8 bits of data to address only 256 colors !
  135.  
  136.  
  137.  
  138.  5. Usage
  139.  --------
  140.  
  141.     GIFconvert is only used from CLI. The syntax is fairly simple:
  142.  
  143.     1)  GIFconvert ?
  144.  
  145.     Will display a short message and my address (in case you still
  146.     don't know it!)
  147.  
  148.  
  149.     2)    GIFconvert [options] <GIF-filename> [<IFF-filename>]
  150.  
  151.     <GIF-filename>    Obviously is the name of the picture to be
  152.             converted. If this file is not found in the
  153.             specified path, the extension '.gif' will be
  154.             added, and another attempt to find the file
  155.             is made.
  156.  
  157.     <IFF-filename>    If this parameter is specified, the converted
  158.             picture will be saved in IFF under this name.
  159.             If no iff-filename was given, the picture will
  160.             only be shown. Please note that GIFconvert was
  161.             not intended to be a picture-viewer (it is too
  162.             slow for that @#$%!  see chapter 6)
  163.  
  164.     [Options] can be one or more of the following:
  165.  
  166.      -t<path> : GIFconvert uses 2 temporary files (due to the
  167.             decrunch-routine, which in fact is an object-
  168.             file, launched from within GIFconvert)
  169.             By default, GIFconvert uses RAM: to store these
  170.             files in. With the '-t' option you can force
  171.             them to another path, for example if you are
  172.             low on ram, you could specify:   -tDF0:  which
  173.             would save the temporary files on DF0:
  174.             A slash (/) is added to the path if necessary.
  175.  
  176.            -d :    By default, the partially converted picture is
  177.             being displayed during Pass3. The '-d' option
  178.             will hide the picture, so you can run GIFconvert
  179.             in the background, without being interrupted.
  180.             Please note that this option only makes sense
  181.             when you want to save the converted picture,
  182.             specifying an <IFF-filename>.
  183.  
  184.            -s :    GIFconvert will normally try to fit the GIF-
  185.             picture on the screen, by turning on interlace
  186.             or hires, or even by skipping pixels in the 
  187.             display. This option will force GIFconvert to
  188.             keep the original size of the GIFpicture. No
  189.             transformation is done.
  190.  
  191.     Examples:    1>   GIFconvert testpic
  192.  
  193.         Will display the picture called TESTPIC (or TESTPIC.GIF)
  194.         Once the picture is fully converted, click mouse to exit.
  195.  
  196.         1>   GIFconvert -d -tdf0:t pc0:testgif dh0:pics/testiff
  197.  
  198.         Will convert the picture in PC0: called TESTGIF (or 
  199.         TESTGIF.GIF), without displaying it, and using DF0:T as
  200.         the Temporary Files-directory. The converted picture
  201.         is saved as 'DH0:pics/testiff'
  202.  
  203.  
  204.  6. Help wanted !
  205.  ----------------
  206.  
  207.     GIFconvert upto version 2.1 uses a C-object file to decrunch the
  208.     pictures, which is V.E.R.Y. slow, but I don't have the sourcecode,
  209.     and it is CRAZY to attempt resourcing it, I've tried !
  210.     I've done some efforts in patching parts of the code with own-written
  211.     stuff, but the results are poor.   S O   P L E A S E:
  212.     Does ANYbody have a GIF-decrunchalgorithm in ANY language ? If you
  213.     do, please send it and I will throw out the old routie and rewrite
  214.     it in megafast Assembler.
  215.  
  216.  
  217.  
  218.  7. Credits and Info
  219.  -------------------
  220.  
  221.     The decrunch-routine is called GIFtoTMP, and was written by Marc 
  222.     Podlipec in 1989. I don't know the author personally, and I don't
  223.     have his address. I just found this tool on a disk long ago. I hope
  224.     he doesn't mind me using it. No copyright notices were found so I 
  225.     guess it was OK.
  226.  
  227.     All other routines were written in assembler by myself, and they 
  228.     should be system-friendly (except the picture-display, which kills
  229.     systemroutines for a while. Use the '-d' option!)
  230.     GIFconvert was succesfully tested under kick1.2, kick1.3 and 
  231.     kick2.0 (Zkicked).
  232.  
  233.     GIF-images using 16 and 256 colors were tested, resolutions from
  234.     1024 horizontally and 780 vertically. I've read about multiple
  235.     images in ONE gif-file, but I haven't encountered them so far.
  236.  
  237.     If you have a GIF-picture that causes problems, please send it to
  238.     me ASAP. You will be rewarded with credits and ofcourse the new
  239.     version as soon as it is available.
  240.  
  241.     Here's the address:
  242.     
  243.     Geert Coelmont
  244.     Eikenlaan 21
  245.     3740 Bilzen
  246.     BELGIUM
  247.     
  248.     Please note that GIFconvert is SceneWare, which means you must
  249.     spread it if you like it, but COMMERCIAL use (outside the scene)
  250.     is NOT allowed without my written permission. Ofcourse PUBLIC DOMAIN
  251.     is just as commercial as any SoftwareHouse, so the restriction
  252.     applies to them as well.
  253.  
  254.  
  255.     Finally, credits must go to:
  256.  
  257.     - Marc Podlipec for the decrunch-program
  258.     - Koen Peetermans, Mike Erasmus and Jan Steegmans for the support
  259.       and the test-pictures
  260.     - Romain V. and Ronny W. for the uploading
  261.     - You for using and spreading this tool !
  262.     - Commodore for supplying us with the best computer ever !
  263.  
  264.  
  265.  
  266.  8. Quick Development Overview
  267.  -----------------------------
  268.  
  269.     v0.0    Was jealous about SVGA. Found a tool called 'GIFtoTMP'.
  270.         Did some research on this 'TMP'-structure. Messed around
  271.         with HAM.
  272.     v0.9    'very-pre' release. I had only 1 picture to test with.
  273.     v1.0    Removed some Mega-bugs. First official release. No save
  274.         option was built-in. (it was still called 'ShowGIF')
  275.     v1.1    Some more small bugs cut out. Never released.
  276.     v1.2    Many special-format pictures tested, wider-than-screen-
  277.         images will now display correctly.
  278.     v2.0    Highly improved version, supports Hi-res and Interlace.
  279.         IFF-save enabled. HAM-pallette now used for (much) better
  280.         results. Typed some worthless DOCS. Released at TRSI-
  281.         party in Leuven. Now called 'GIFconvert'.
  282.     v2.1    Runtime options -d, -t and -s added. Better argument
  283.         parser. You now can break the decruncher with 'CTRL-C'.
  284.         Small bug in IFF-save removed. '.GIF' is added to the
  285.         input-filename automagically, because I was too lazy to
  286.         type it myself. DOCS updated (lame job!)
  287.         v2.12    Runtime options cleaned-up: '-d' screw up the saved IFF
  288.         picture.
  289.